<!DOCTYPE html>
<!--suppress ALL -->
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>数据可视化设置</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="../plugins/layui/css/myPage.css">

</head>
<body>
<div class="layui-container">


    <form class="layui-form">
        <div class="layui-row">
            <div class="layui-col-md12">

                <fieldset class="layui-elem-field" style="margin-top: 20px;">
                    <legend>数据可视化设置</legend>

                    <div class="layui-col-md2" style="padding-top: 15px;padding-left: 15px">
                        <div class="layui-form-item" >
                            <div class="layui-inline"style="width: 130px">
                                <label style="color: #0099ff">驾驶员在职状态</label>
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <div class="layui-inline">
                                <input type="checkbox"    value="jsyb" id="checkbox1"/>饼形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"      value="jsyh"  id="checkbox2"/>环形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"   value="jsyz"   id="checkbox3"/>柱形图<br />
                            </div>
                        </div>
                    </div>
                        <div class="layui-col-md2" style="padding-top: 15px;padding-left: 15px">
                        <div class="layui-form-item">
                            <div class="layui-inline"style="width: 130px">
                                <label style="color: #0099ff" >在职驾驶员工作状态</label>
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <div class="layui-inline">
                                <input type="checkbox"    value="zzjsyb"  id="checkbox4" />饼形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"      value="zzjsyh"   id="checkbox5"/>环形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"      value="zzjsyz"    id="checkbox6"/>柱形图<br />
                            </div>
                        </div>
                        </div>
                    <div class="layui-col-md2" style="padding-top: 15px;padding-left: 15px">
                        <div class="layui-form-item">
                            <div class="layui-inline"style="width: 130px">
                                <label style="color: #0099ff">车辆分配状态</label>
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <div class="layui-inline">
                                <input type="checkbox"     value="clb"    id="checkbox7"/>饼形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"   value="clh"  id="checkbox8"/>环形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"  value="clz"   id="checkbox9"/>柱形图<br />
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md2" style="padding-top: 15px;padding-left: 15px">
                        <div class="layui-form-item">
                            <div class="layui-inline"style="width: 130px">
                                <label style="color: #0099ff">未分配车辆状态</label>
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <div class="layui-inline">
                                <input type="checkbox"    value="wfpclb"  id="checkbox10"/>饼形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"  value="wfpclh"   id="checkbox11"/>环形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"   value="wfpclz"  id="checkbox12"/>柱形图<br />
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md2" style="padding-top: 15px;padding-left: 15px">
                        <div class="layui-form-item">
                            <div class="layui-inline"style="width: 130px">
                                <label style="color: #0099ff">订单状态</label>
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <div class="layui-inline">
                                <input type="checkbox"    value="ddb"  id="checkbox15"/>饼形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"    value="ddh"  id="checkbox16"/>环形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"   value="ddz"   id="checkbox17"/>折线图/柱形图<br />
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md2" style="padding-top: 15px;padding-left: 15px">
                        <div class="layui-form-item">
                            <div class="layui-inline"style="width: 130px">
                                <label style="color: #0099ff">运单状态</label>
                            </div>
                        </div>
                        <div class="layui-form-item" >
                            <div class="layui-inline">
                                <input type="checkbox"    value="ydb"  id="checkbox13"/>饼形图<br />
                            </div>
                            <div class="layui-inline">
                                <input type="checkbox"   value="ydz"   id="checkbox14"/>柱形图<br />
                            </div>
                        </div>
                    </div>



                </fieldset>
            </div>
        </div>

        <button id="modiSub" class="layui-btn layui-btn-normal "  lay-submit lay-filter="update" style="width: 10%; position: absolute;left: 35%"  >立即提交</button>

    </form>
</div>
<script src="../plugins/layui/layui.js"></script>
<script src="../js/config.js"></script>
<script src="../js/tools.js"></script>
<script type="text/javascript">
    layui.use(['table','form','layer','laydate','upload'],function () {
        var table = layui.table;
        var form = layui.form;
        var $ = layui.$;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var $ = layui.jquery;
        var piclist={};
        var piclistid = "";




        $.ajax({
            url: contextPath+"/piclist",
            type: "GET",
            contentType:"application/json;charset=utf-8",
            dataType:"json",
            success: function(res) {
                console.log(res);
                if(res.jsyb == true){
                  $("#checkbox1").attr("checked","checked");
                    $("#checkbox1").prop("checked",true);
                }else {
                    $("#checkbox1").prop("checked",false);
                    $("#checkbox1").removeAttr("checked");
                }
                if(res.jsyh == true){
                    $("#checkbox2").attr("checked","checked");
                    $("#checkbox2").prop("checked",true);
                }else {
                    $("#checkbox2").prop("checked",false);
                    $("#checkbox2").removeAttr("checked");
                }
                if(res.jsyz == true){
                    $("#checkbox3").attr("checked","checked");
                    $("#checkbox3").prop("checked",true);
                }else {
                    $("#checkbox3").prop("checked",false);
                    $("#checkbox3").removeAttr("checked");
                }
                if(res.zzjsyb == true){
                    $("#checkbox4").attr("checked","checked");
                    $("#checkbox4").prop("checked",true);
                }else {
                    $("#checkbox4").prop("checked",false);
                    $("#checkbox4").removeAttr("checked");
                }
                if(res.zzjsyh == true){
                    $("#checkbox5").attr("checked","checked");
                    $("#checkbox5").prop("checked",true);
                }else {
                    $("#checkbox5").prop("checked",false);
                    $("#checkbox5").removeAttr("checked");
                }
                if(res.zzjsyz == true){
                    $("#checkbox6").attr("checked","checked");
                    $("#checkbox6").prop("checked",true);
                }else {
                    $("#checkbox6").prop("checked",false);
                    $("#checkbox6").removeAttr("checked");
                }
                if(res.clb == true){
                    $("#checkbox7").attr("checked","checked");
                    $("#checkbox7").prop("checked",true);
                }else {
                    $("#checkbox7").prop("checked",false);
                    $("#checkbox7").removeAttr("checked");
                }
                if(res.clh == true){
                    $("#checkbox8").attr("checked","checked");
                    $("#checkbox8").prop("checked",true);
                }else {
                    $("#checkbox8").prop("checked",false);
                    $("#checkbox8").removeAttr("checked");
                }
                if(res.clz == true){
                    $("#checkbox9").attr("checked","checked");
                    $("#checkbox9").prop("checked",true);
                }else {
                    $("#checkbox9").prop("checked",false);
                    $("#checkbox9").removeAttr("checked");
                }
                if(res.wfpclb == true){
                    $("#checkbox10").attr("checked","checked");
                    $("#checkbox10").prop("checked",true);
                }else {
                    $("#checkbox10").prop("checked",false);
                    $("#checkbox10").removeAttr("checked");
                }
                if(res.wfpclh == true){
                    $("#checkbox11").attr("checked","checked");
                    $("#checkbox11").prop("checked",true);
                }else {
                    $("#checkbox11").prop("checked",false);
                    $("#checkbox11").removeAttr("checked");
                }
                if(res.wfpclz == true){
                    $("#checkbox12").attr("checked","checked");
                    $("#checkbox12").prop("checked",true);
                }else {
                    $("#checkbox12").prop("checked",false);
                    $("#checkbox12").removeAttr("checked");
                }
                if(res.ddb == true){
                    $("#checkbox15").attr("checked","checked");
                    $("#checkbox15").prop("checked",true);
                }else {
                    $("#checkbox15").prop("checked",false);
                    $("#checkbox15").removeAttr("checked");
                }
                if(res.ddh == true){
                    $("#checkbox16").attr("checked","checked");
                    $("#checkbox16").prop("checked",true);
                }else {
                    $("#checkbox16").prop("checked",false);
                    $("#checkbox16").removeAttr("checked");
                }
                if(res.ddz == true){
                    $("#checkbox17").attr("checked","checked");
                    $("#checkbox17").prop("checked",true);
                }else {
                    $("#checkbox17").prop("checked",false);
                    $("#checkbox17").removeAttr("checked");
                }
                if(res.ydb == true){
                    $("#checkbox13").attr("checked","checked");
                    $("#checkbox13").prop("checked",true);
                }else {
                    $("#checkbox13").prop("checked",false);
                    $("#checkbox13").removeAttr("checked");
                }
                if(res.ydz == true){
                    $("#checkbox14").attr("checked","checked");
                    $("#checkbox14").prop("checked",true);
                }else {
                    $("#checkbox14").prop("checked",false);
                    $("#checkbox14").removeAttr("checked");
                }
                form.render();
                piclistid = res.piclistid;

            }
        });

        $(":checkbox").each(function () {
            $(this).click(function () {

                if ($(this).prop("checked")==true) {
                    piclist.$(this).val()= false;
                    $(this).removeAttr("checked");
                    $(this).prop("checked",false);
                    piclistArr.push(piclist);
                } else {
                    piclist.$(this).val() = true;
                    $(this).attr("checked","checked");
                    $(this).prop("checked",true);
                    piclistArr.push(piclist);
                }
            });
        });

        form.on('submit(update)', function(){

            piclist.piclistid = piclistid;
            if($("#checkbox1").prop("checked")==true){
                piclist.jsyb = true;
            }else {
                piclist.jsyb = false;
            }
            if($("#checkbox2").prop("checked")==true){
                piclist.jsyh = true;
            }else {
                piclist.jsyh = false;
            }
            if($("#checkbox3").prop("checked")==true){
                piclist.jsyz = true;
            }else {
                piclist.jsyz = false;
            }
            if($("#checkbox4").prop("checked")==true){
                piclist.zzjsyb = true;
            }else {
                piclist.zzjsyb = false;
            }
            if($("#checkbox5").prop("checked")==true){
                piclist.zzjsyh = true;
            }else {
                piclist.zzjsyh = false;
            }
            if($("#checkbox6").prop("checked")==true){
                piclist.zzjsyz = true;
            }else {
                piclist.zzjsyz = false;
            }
            if($("#checkbox7").prop("checked")==true){
                piclist.clb = true;
            }else {
                piclist.clb = false;
            }
            if($("#checkbox8").prop("checked")==true){
                piclist.clh = true;
            }else {
                piclist.clh = false;
            }
            if($("#checkbox9").prop("checked")==true){
                piclist.clz = true;
            }else {
                piclist.clz = false;
            }
            if($("#checkbox10").prop("checked")==true){
                piclist.wfpclb = true;
            }else {
                piclist.wfpclb = false;
            }
            if($("#checkbox11").prop("checked")==true){
                piclist.wfpclh = true;
            }else {
                piclist.wfpclh = false;
            }
            if($("#checkbox12").prop("checked")==true){
                piclist.wfpclz = true;
            }else {
                piclist.wfpclz = false;
            }
            if($("#checkbox13").prop("checked")==true){
                piclist.ydb = true;
            }else {
                piclist.ydb = false;
            }
            if($("#checkbox14").prop("checked")==true){
                piclist.ydz = true;
            }else {
                piclist.ydz = false;
            }
            if($("#checkbox15").prop("checked")==true){
                piclist.ddb = true;
            }else {
                piclist.ddb = false;
            }
            if($("#checkbox16").prop("checked")==true){
                piclist.ddh = true;
            }else {
                piclist.ddh = false;
            }
            if($("#checkbox17").prop("checked")==true){
                piclist.ddz = true;
            }else {
                piclist.ddz = false;
            }

            console.log(piclist);
            $.ajax({
                url: contextPath+"/piclist",
                type: "PUT",
                contentType:"application/json;charset=utf-8",
                data: JSON.stringify(piclist) ,
                dataType:"json",
                success: function(res) {

                    layer.msg(res.message,{
                        icon: 1,
                        time: 1000 //2秒关闭（如果不配置，默认是3秒）
                    } );
                }
            });
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    });

</script>
</form>
</body>
</html>